package cn.com.huzo.service.oa.impl;

import cn.com.huzo.model.entities.oa.MyCalendarEntity;
import cn.com.huzo.repository.oa.MyCalendarRepository;
import cn.com.huzo.service.oa.MyCalendarManager;
import huzofw.service.impl.GenericManagerImpl;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 我的日程管理服务对象类实现。
 *
 * @author 吴旭
 */
@Service("MyCalendarManager")
public class MyCalendarManagerImpl extends GenericManagerImpl<MyCalendarEntity, String>
        implements MyCalendarManager {

    @Resource(name = "MyCalendarRepository")
    private MyCalendarRepository _dao;

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Transactional
    @Override
    public MyCalendarEntity fetchByKey(String key) throws Exception {
        return _dao.fetchByKey(key);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Transactional
    @Override
    public List<MyCalendarEntity> fetchCalendar(Long userId, Date start, Date end) throws Exception {
        return _dao.fetchCalendar(userId, start, end);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Transactional
    @Override
    public String insert(MyCalendarEntity instance) throws Exception {
        return _dao.insert(instance);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Transactional
    @Override
    public Integer update(MyCalendarEntity instance) throws Exception {
        return _dao.update(instance);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Transactional
    @Override
    public Integer delete(MyCalendarEntity instance) throws Exception {
        return _dao.delete(instance.getCalendarId());
    }
}
